package org.miyuki4j.cfgtool;

import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * @Desc
 * @Author miyuki4j
 * @Date 2025/7/24/星期四 17:04
 * @Version 1.0
 */
@Getter
@Setter
public class TableDataCell {

    private final int column;
    private final String value;
    private String columnName;
    private String exportValue;

    public TableDataCell(int column, String value) {
        this.column = column;
        this.value = value;
        this.exportValue = value;
    }

    public TableDataCell(String columnName, String value) {
        this.column = -1;
        this.columnName = columnName;
        this.value = value;
    }

    @Override
    public String toString() {
        return "TableDataCell{" +
                "column=" + column +
                ", value='" + value + '\'' +
                ", columnName='" + columnName + '\'' +
                ", exportValue='" + exportValue + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;

        TableDataCell that = (TableDataCell) o;
        return column == that.column && Objects.equals(value, that.value) && Objects.equals(columnName, that.columnName) && Objects.equals(exportValue, that.exportValue);
    }

    @Override
    public int hashCode() {
        int result = column;
        result = 31 * result + Objects.hashCode(value);
        result = 31 * result + Objects.hashCode(columnName);
        result = 31 * result + Objects.hashCode(exportValue);
        return result;
    }
}
